import 'package:flutter/material.dart';
import 'package:wallpaper/components/button/normal_button.dart';

class MyAlertDialog {
  final Function onPressed;
  final String title;
  final String content;
  const MyAlertDialog(
      {required this.onPressed, required this.title, required this.content});
  void show(BuildContext context) {
    showGeneralDialog(
      context: context,
      pageBuilder: (BuildContext buildContext, Animation<double> animation,
          Animation<double> secondaryAnimation) {
        return AlertDialog(
          title: Text(title, style: TextStyle(color: Colors.white)),
          backgroundColor: const Color.fromARGB(150, 0, 0, 0),
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(10),
          ),
          elevation: 6,
          shadowColor: Colors.black26,
          actions: [
            SizedBox(
              height: 28,
              width: 100,
              child: NormalButton(
                radius: 20,
                fontSize: 16,
                title: '确定',
                onPressed: () {
                  onPressed();
                  Navigator.pop(context);
                },
              ),
            ),
            SizedBox(
              height: 28,
              width: 100,
              child: NormalButton(
                radius: 20,
                title: '取消',
                fontSize: 16,
                onPressed: () {
                  Navigator.pop(context);
                },
                bgColor: Colors.grey[700]!,
              ),
            )
          ],
          content: Text(content, style: TextStyle(color: Colors.white)),
        );
      },
    );
  }
}
